# -*- coding:utf-8 -*-
# @FileName  :dhcc_ent_common.py
# @Time      :2020/12/15 11:32
# @Author    :Zhoujirong
# @Desc      : common接口
import parameterized
import json
from common.log import Log
from biz.flow.ent_common import EntCommonRequest
from biz.cases.base_case import BaseCase
from common.params_operator import Param


class TestEntCommon(BaseCase):
    @classmethod
    def setUpClass(cls) -> None:
        cls.cookie = BaseCase().get_token()

    @parameterized.parameterized.expand(Param.from_excel('ent_common_dic.xls'))
    def test_get_dic(self, type, check, desc):
        self._testMethodDoc = desc
        ret = EntCommonRequest.get_dic(type, self.cookie)
        Log.info(ret)
        check = check.replace('\n','')
        check = json.loads(check)
        self.assertEqual(check, ret)

    def test_get_deptcodename(self):
        '''获取机构code和name'''
        type = 'deptCodeName'
        ret = EntCommonRequest.get_deptcodename(type,self.cookie)
        Log.info(ret)
        self.assertIsNotNone(ret)

    def test_get_orgtree(self):
        '''获取机构树'''
        type = 'orgTreeData'
        ret = EntCommonRequest.get_orgtree(type, self.cookie)
        Log.info(ret)
        self.assertIsNotNone(ret)

    def test_get_system_name(self):
        '''当前子系统名称'''
        type = 'sysCode'
        ret = EntCommonRequest.get_system_name(type, self.cookie)
        Log.info(ret)
        self.assertEqual('企业前置查询系统', ret.QE001)



if __name__ == "__main__":
    pass